package com.zhou.base.security.test111.config;

import org.springframework.context.annotation.Bean;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

@EnableRedisHttpSession(maxInactiveIntervalInSeconds=60,redisNamespace="zxf:spring:session")
public class SpringSessionConfig {
    @Bean
    public HttpSessionEventPublisher httpSessionEventPublisher() {
        return new HttpSessionEventPublisher();
    }

    /**
     * @Override
     * protected void configure(HttpSecurity http) throws Exception {
     * 	http
     * 		// ... additional configuration ...
     * 		.rememberMe((rememberMe) -> rememberMe
     * 			.rememberMeServices(rememberMeServices())
     * 		);
     * }
     *
     * @Bean
     * public SpringSessionRememberMeServices rememberMeServices() {
     * 	SpringSessionRememberMeServices rememberMeServices =
     * 			new SpringSessionRememberMeServices();
     * 	// optionally customize
     * 	rememberMeServices.setAlwaysRemember(true);
     * 	return rememberMeServices;
     * }
     *
     *
     *@Configuration
     * public class SecurityConfiguration<S extends Session> extends WebSecurityConfigurerAdapter {
     *
     *        @Autowired
     *    private FindByIndexNameSessionRepository<S> sessionRepository;
     *
     *    @Override
     *    protected void configure(HttpSecurity http) throws Exception {
     * 		// @formatter:off
     * 		http
     * 			// other config goes here...
     * 			.sessionManagement((sessionManagement) -> sessionManagement
     * 				.maximumSessions(2)
     * 				.sessionRegistry(sessionRegistry())
     * 			);
     * 		// @formatter:on
     *    }
     *
     *    @Bean
     *    public SpringSessionBackedSessionRegistry<S> sessionRegistry() {
     * 		return new SpringSessionBackedSessionRegistry<>(this.sessionRepository);
     *    }
     *
     * }
     */
}
